﻿@using MUnique.OpenMU.AdminPanel.Models

<div>
    <select className="btn extensions" name="extensionPoints" @onchange=@OnSelectionChanged>
        <option value="00000000-0000-0000-0000-000000000000">All</option>
        @foreach (var point in this.ExtensionPoints.OrderBy(e => e.Name))
        {
            @if (this.SelectedPointId == point.Id)
            {
                <option value=@point.Id selected>@point.Name (@point.PlugInCount)</option>
            }
            else
            {
                <option value=@point.Id>@point.Name (@point.PlugInCount)</option>
            }
        }
    </select>
</div>
@code {
    /// <summary>
    /// Gets or sets the selected extension point.
    /// </summary>
    [Parameter]
    public Guid SelectedPointId { get; set; }

    /// <summary>
    /// Gets or sets the extension points.
    /// </summary>
    [Parameter]
    public ICollection<PlugInPointViewItem> ExtensionPoints { get; set; } = null!;

    /// <summary>
    /// Gets or sets the selection changed event.
    /// </summary>
    [Parameter]
    public EventCallback<ChangeEventArgs> OnSelectionChanged { get; set; }
}
